<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<%-- <c:set value="${requestScope.response.data.one }" var="pojo"/> --%>
<jsp:useBean class="com.sys.goods.pojo.AGoods" id="pojo"/>
<!-- 盲盒列表 -->
<c:set value="${requestScope.boxResponse.data.list }" var="boxList" />
<!DOCTYPE HTML>
<html>
	<head>
		<%@ include file="/common/include/title.jsp"%>
		<title>商品添加 - 盲盒商城系统</title>
	</head>
	<body>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页 
			<span class="c-gray en">&gt;</span> 商品管理 
			<span class="c-gray en">&gt;</span> 添加商品
			<a class="btn btn-success radius r"
				style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新">
				<i class="Hui-iconfont">&#xe68f;</i>
			</a>
		</nav>
		<article class="page-container">
			<form class="form form-horizontal" id="formSubmit" action="${rootPath }/back/goods/goodsInsertSubmit" method="post">
				<div class="row cl">
					<label for="email" class="form-label col-xs-4 col-sm-2">盲盒:</label>
					<div class="col-sm-8">
						<select name="blindBoxId" class="select">
							<c:forEach items="${boxList}" var="listTemp" varStatus="stat">
								<option value="${listTemp.blindBoxId }" ${one.blindBoxId == listTemp.blindBoxId ? 'selected' : '' }>${listTemp.blindBoxIntroduce}</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="${pojo.goodsName}" placeholder="请输入名称"
							id="goodsName" name="goodsName">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>价格：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="${pojo.goodsPrices}" placeholder="请输入价格"
							id="goodsPrices" name="goodsPrices">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>介绍：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="${pojo.goodsIntroduce}" placeholder="请输入介绍"
							id="goodsIntroduce" name="goodsIntroduce">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>数量：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="${pojo.goodsQuantity}" placeholder="请输入数量"
							id="goodsQuantity" name="goodsQuantity">
					</div>
				</div>
				<!-- <div class="row cl">
					<label for="email" class="form-label col-xs-4 col-sm-2">图片:</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="file" id="file" name="file"
							class="form-control">
					</div>
				</div> -->
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>品牌：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="${pojo.goodsPicture}" placeholder="请输入品牌"
							id="commodityBrand" name="commodityBrand">
					</div>
				</div>
				
			
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">状态：</label>
					<div class="formControls col-xs-8 col-sm-9 skin-minimal">
						<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
							<c:if test="${fn:startsWith(me.key,'STATUS')}">
								<!-- 拆分,按照-拆分,取最后一个 -->
								<c:set value="${fn:split(me.key, '-')}" var="keys"/>
								<div class="radio-box">
									<label for="${me.key }">
										<input type="radio" id="${me.key }" name="status" value="${keys[1] }" ${pojo.status == keys[1] ? 'checked' : '' }>
										&nbsp;${me.value }
									</label>
								</div>
							</c:if>
						</c:forEach>
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
						<button 
							class="btn btn-primary radius" type="submit">
							<i class="Hui-iconfont">&#xe632;</i> 提交
						</button>
					</div>
				</div>
			</form>
		</article>
		<%@ include file="/common/include/footer.jsp" %>
		<script type="text/javascript" >
			$(function(){
				$('.skin-minimal input').iCheck({
					checkboxClass: 'icheckbox-blue',
					radioClass: 'iradio-blue',
					increaseArea: '20%'
				});
				
				//表单验证
				$("#formSubmit").validate({
					rules:{
						email : {
							required : true,
							email:true,
						},
						phone:{
							required:true,
							isPhone:true,
						},
						qq:{
							required:true,
							isQq : true,
						},
						password:{
							required:true,
						},
						confirmPassword:{
							required:true,
							equalTo: "#password",
						},
					},
					onkeyup:false,
					focusCleanup:true,
					success:"valid",
					submitHandler:function(form){
						$(form).ajaxSubmit({
							type: 'post',
							success: function(data){
								/* 弹出框 */
								layer.msg(data.info,{icon:1,time:3000},function()
								{
									if(data.code == '0')
									{
										var index = parent.layer.getFrameIndex(window.name);
										parent.$('.btn-success').click();
										parent.layer.close(index);
									}
								});
							},
							error: function(XmlHttpRequest, textStatus, errorThrown){
								layer.msg('error!',{icon:1,time:1000});
							},
							dataType:"json"
						});
					}
				});
				/* 初始化百度编辑器 */
				var ue = UE.getEditor('editor');
				
				/* 查询一级节点 */
				selectRegion('region1','region1','regionId','true');
			});
		</script>
	</body>
</html>